Skip to content

Comments

Multi-agent communication graph#150

Draft
jamiepine wants to merge 18 commits intomainfrom
feat/multi-agent-communication-graph
Draft

Multi-agent communication graph#150
jamiepine wants to merge 18 commits intomainfrom
feat/multi-agent-communication-graph

Conversation

@jamiepine
Copy link
Member

@jamiepine jamiepine commented Feb 22, 2026

Summary

Screenshot 2026-02-23 at 3 31 01 AM

Foundation for 0.2.0 — adds a directed communication graph between agents so they can coordinate, delegate, escalate, and share context through explicit links with relationship semantics.

  • Agent links with direction (one-way/two-way) and relationship policies (peer/superior/subordinate). Defined via [[links]] config sections, hot-reloadable via the existing file watcher. Config is already runtime-mutable through the API so no separate database needed.
  • send_agent_message tool resolves target agent, validates link direction, constructs an InboundMessage with source: "internal", and pushes through MessagingManager::inject_message(). No new transport.
  • ROLE.md identity file for operational responsibilities — separates what the agent does from who it is (IDENTITY.md) and how it behaves (SOUL.md).
  • Org context prompt — agents see their position in the hierarchy (superiors/subordinates/peers) so they can reason about delegation vs escalation.
  • Link channel context — when a channel is an internal link channel, the prompt frames the conversation with relationship semantics.
  • Process events AgentMessageSent/AgentMessageReceived with SSE forwarding for dashboard visibility.
  • Read-only API endpoints — list links (/api/links), per-agent links (/api/agents/:id/links), topology snapshot (/api/topology) for the future React Flow graph editor.
[[links]]
from = "support"
to = "engineering"
direction = "two_way"
relationship = "subordinate"

[[links]]
from = "manager"
to = "support"
direction = "two_way"
relationship = "superior"

Directed links between agents with relationship semantics (peer/superior/subordinate),
a shared instance-level database, and a send_agent_message tool that routes through
the existing MessagingManager pipeline. Foundation for the 0.2.0 release.

- Instance database (instance.db) with separate migration path for cross-agent data
- AgentLink model with direction (one_way/two_way) and relationship policies
- LinkStore CRUD backed by instance.db
- [[links]] config section with startup sync
- send_agent_message tool: resolves target, validates link, injects InboundMessage
- ROLE.md identity file for operational responsibilities
- Org context prompt fragment (superiors/subordinates/peers hierarchy)
- Link context prompt fragment for agent-to-agent channels
- AgentMessageSent/Received process events with SSE forwarding
- Link CRUD API endpoints + topology snapshot endpoint
Links are defined in [[links]] config sections and stored in a shared
ArcSwap<Vec<AgentLink>> that hot-reloads when config.toml changes.
No separate database needed since config is already runtime-mutable
through the API.

- Remove InstanceDb, migrations_instance/, LinkStore
- Links parsed from config at startup via AgentLink::from_config()
- Shared via Arc<ArcSwap<Vec<AgentLink>>> passed to agents and API
- File watcher reloads links on config.toml changes
- API endpoints simplified to read-only (list, agent links, topology)
- Deterministic link channel IDs from sorted agent ID pairs
- ROLE.md added to file watcher identity change detection
- Added new API endpoints for creating, updating, and deleting agent links.
- Introduced data structures for managing agent links and their relationships.
- Enhanced the frontend with a TopologyGraph component to visualize agent connections.
- Updated the LiveContext to track active links based on message activity.
- Modified Overview component to integrate the new TopologyGraph and display active links.
…unctionality

- Added optional display name and role fields to the AgentInfo and TopologyAgent interfaces.
- Introduced new TopologyGroup interface and related API endpoints for creating, updating, and deleting agent groups.
- Updated CreateAgentDialog to support input for display names and roles.
- Enhanced TopologyGraph to visualize agent groups and their relationships.
- Modified API and state management to handle agent groups effectively.
- Updated ToolActivityIndicator and WebChatPanel for better layout and responsiveness.
- Introduced FloatingChatInput for a more user-friendly input experience.
- Added ThinkingIndicator for visual feedback during processing.
- Enhanced message display logic for clearer user interactions.
- Improved styling and structure for better visual consistency across components.
- Added support for managing org-level humans with CRUD operations via new API endpoints.
- Introduced TopologyHuman interface to represent humans in the topology.
- Enhanced the ApiState to include a list of humans for topology visualization.
- Updated the configuration to support human definitions and ensure persistence.
- Modified the TopologyGraph component to accommodate human nodes alongside agents.
- Improved error handling for human-related operations in the API.
…tures

- Renamed LinkRelationship to LinkKind to better reflect the nature of connections between nodes.
- Updated related interfaces and API structures to use the new LinkKind terminology.
- Enhanced the TopologyGraph component to accommodate changes in link representation.
- Added optional bio field to human definitions for improved context in the topology.
- Improved backward compatibility for existing configurations using the old relationship terminology.
- Introduced a new lockfile (bun.lock) to manage dependencies for the project.
- Updated the agents documentation to include a communication graph for agent coordination, enhancing the description of agent capabilities and configuration.
- Added details on agent roles and definitions, improving clarity on agent functionalities and their interactions within the system.
… editing

- Added an API endpoint to update agent details, including display name and role.
- Introduced a new AgentEditDialog component for editing agent information within the TopologyGraph.
- Enhanced the TopologyGraph to support edit actions for both human and agent nodes.
- Improved UI elements for better interaction and visibility of edit options in the graph.
… routing

- Implemented a new API endpoint for deleting channels and their message history.
- Added a delete button in the ChannelCard component to trigger channel deletion.
- Enhanced internal message handling to route replies back to the appropriate link channels, preserving conversation context.
- Updated the ChannelStore to support channel deletion with proper database operations.
- Improved link channel management to ensure each agent has a dedicated conversation ID for better message routing.
- Added functionality for link channels, allowing agents to maintain dedicated channels for communication and track conversation history.
- Implemented a `conclude_link` tool to gracefully end link conversations, routing summaries back to the originating channel.
- Updated agent status blocks to display active link conversations and their turn counts.
- Enhanced internal message handling to support the new link management features, including safety caps for conversation turns.
- Improved documentation to reflect changes in link channel behavior and the new conclusion process.
- Addressed a naming mismatch between the webchat adapter and frontend session IDs, proposing a unified naming convention for clarity.
- Updated message logging to include sender names for both user and bot messages, improving message traceability in the conversation history.
- Enhanced internal message handling to propagate originating source information for better routing in link conversations.
- Introduced new methods for logging bot messages with display names, ensuring accurate representation in the conversation log.
- Introduced checks for delegation targets in link channels to prevent loops and ensure proper message routing.
- Added functionality to manage originating channels for agent messages, improving clarity in link conversation flows.
- Updated the SendAgentMessageTool to handle upstream counterparty checks, preventing incorrect message delegation.
- Enhanced internal message handling to support late-arriving link conclusions and ensure proper routing back to originating channels.
- Improved logging for link conclusion messages to maintain conversation integrity.
…unication-graph

# Conflicts:
#	src/agent/channel.rs
Introduced a new function `truncate_for_log` to handle message truncation for logging, ensuring messages do not exceed a specified character limit. Updated the `init_background_tracing` and `init_foreground_tracing` functions to utilize this new truncation logic. Added unit tests to verify the functionality of the truncation, including handling of multibyte characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant